function sumFibs(num) {
    const arr = [1, 1];

    for (let i = arr.length; i < num; i++) {
        const sum = arr[i - 2] + arr[i - 1];
        if (sum > num) break;
        arr[i] = sum;
    }

    return arr.reduce((total, current) => total + (current & 1 ? current : 0));
}
sumFibs(4);
